package net.itbaiyang.pattern.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum SmsTypeEnum {

    // 腾讯消息
    TENCENT_SMS("tencent_sms", "tencentSmsService"),

    // 阿里云消息
    ALIYUN_SMS("aliyun_sms", "aliyunSmsService");

    private final String type;
    private final String beanName;

    // 通过字符串值获取枚举类型
    public static SmsTypeEnum fromString(String type) {
        for (SmsTypeEnum smsType : SmsTypeEnum.values()) {
            if (smsType.getType().equalsIgnoreCase(type)) {
                return smsType;
            }
        }
        throw new RuntimeException("邮件枚举类型输入错误");
    }
}
